package com.yss.common.core.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

/**
 * 参数配置的键
 *
 * @author lsl
 */
@Getter
@AllArgsConstructor
public enum YssConfigEnum implements BaseEnum<String> {
    REPORTWORLD_ZIP_RESOURCES("reportworld.zip.resources", "升级工具ZIP文件资源包"),
    REPORTWORLD_WX_SEND_USERNAME("reportworld.wx.send.username", "报表世界数据管理平台企业微信提示人名称"),
    REPORTWORLD_WX_SEND_WECOMURL("reportworld.wx.send.wecomurl", "报表世界数据管理平台企业微信机器人地址"),
    REPORTWORLD_WX_SEND_USERNAME_MANAGE("reportworld.wx.send.username.manage", "报表世界数据管理平台企业微信提示人名称,管理信息"),
    REPORTWORLD_WX_SEND_WECOMURL_MANAGE("reportworld.wx.send.wecomurl.manage", "报表世界数据管理平台企业微信机器人地址,管理信息"),
    REPORTWORLD_TABLE_DETAIL_CUSTOMER("reportworld.table.detail.customer", "表字段信息是否区分客户"),
    REPORTWORLD_TABLE_DETAIL_REPORT("reportworld.table.detail.report", "表字段信息是否区分报表"),
    REPORTWORLD_TABLE_DETAIL_MODULAR("reportworld.table.detail.modular", "表字段信息是否区分模块"),
    REPORTWORLD_TABLE_WARNING("reportworld.table.warning", "报表世界大数据表"),
    REPORTWORLD_CHECK_VERSION("reportworld.check.version", "报表世界调整表和字段信息版本检查"),
    REPORTWORLD_NAME_CHECK("reportworld.name.check", "报表世界表名校验"),
    REPORTWORLD_NAME_CHECK_KEYWORDS("reportworld.name.check.keywords", "报表世界表名校验关键字检查"),
    REPORTWORLD_NAME_CHECKMSG("reportworld.name.checkmsg", "报表世界表名校验提示信息"),
    REPORTWORLD_MYSQL_TABLE_CHECK("reportworld.mysql.table.check", "MYSQL表结构检查"),
    DATABASE_INFO_JSON_DATADICT_CUSTOMER("database.info.json.datadict.customer", "字典数据是否区分客户"),
    DATABASE_INFO_JSON_DATADICT_REPORT("database.info.json.datadict.report", "字典数据是否区分报表"),
    DATABASE_INFO_JSON_DATADICT_MODULAR("database.info.json.datadict.modular", "字典数据是否区分模块");
    private final String code;
    private final String desc;

    public static YssConfigEnum getEnum(String code) {
        return Arrays.stream(values()).filter(b -> b.code == code).findFirst().orElse(null);
    }

    public static String getEnumDesc(String code) {
        YssConfigEnum e = getEnum(code);
        return e != null ? e.desc : null;
    }
}
